#!/bin/sh
# Grid Engine options (lines prefixed with #$)
#$ -N runPedigreeTest
#$ -cwd                  
#$ -l h_rt=24:00:00
#$ -l h_vmem=8G
#$ -pe sharedmem 1
#$ -e logs
#$ -o logs


if [ $1 = submit ] ; then 

    module load  uge
    for rep in {1..10}; do
        # Figure 1: HD Markers
        for nHD in 100 500 1000; do
            qsub runCreateData.sh hd_markers $rep 10 $nHD 1
        done
        
        # Figure 1: Training set size
        qsub runCreateData.sh base $rep 10 500 1

        for nChr in 5 10 15 20; do
            qsub runCreateData.sh num_chr $rep $nChr 500 1
        done

        for map in 0.5 1 2 4; do
            qsub runCreateData.sh map_len $rep 10 500 $map
        done

    done    
    exit 1
fi


if [ $1 = test ] ; then 
    ./runCreateData.sh base 1 10 500 1
    exit 1
fi



. /etc/profile.d/modules.sh

. ~/.bashrc
# export PATH=/exports/cmvm/eddie/eb/groups/hickey_group/R-Folder/R-3.5.1/bin/:$PATH
# export LD_LIBRARY_PATH=/exports/eddie3_apps_local/apps/SL7/intel/parallel_studio_xe_2017_update4/compilers_and_libraries/linux/lib/intel64:$LD_LIBRARY_PATH
# export LD_LIBRARY_PATH=/exports/eddie3_apps_local/apps/SL7/intel/parallel_studio_xe_2017_update4/compilers_and_libraries/linux/mkl/lib/intel64:$LD_LIBRARY_PATH

export OMP_NUM_THREADS=$NSLOTS
export MKL_NUM_THREADS=$NSLOTS

sim=$1
rep=$2
nChr=$3
nSnp=$4
maplength=$5

mkdir results
mkdir logs

fileDir=data/$sim/$rep/dataFor-$nChr-$nSnp-$maplength

rm -r $fileDir
mkdir -p $fileDir

cp -r base/* $fileDir
cd $fileDir

mkdir genotypes
mkdir imputed
mkdir results

### Create data

Rscript createTestData.r $nChr $nSnp $maplength
